package com.onlinemarket.dao;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.stereotype.Repository;

import com.onlinemarket.dao.entity.CategoryEO;
import com.onlinemarket.util.OnlineMarketUtil;

@Repository
public class CategoryDAOImpl implements CategoryDAO {

	@Autowired
	private NamedParameterJdbcTemplate jdbcTemplate;

	public CategoryEO save(CategoryEO categoryEO) {
		String sql = "insert into categories(name,description,parent_id,created_date,created_by_id) values(:name,:description,:parentId,:createdDate,:createdById)";
		Map<String, Object> paramMap = OnlineMarketUtil.getOnlineMarketUtil()
				.buildJbdcNamedParamValue(categoryEO);
		jdbcTemplate.update(sql, paramMap);
		return categoryEO;
	}

	public CategoryEO update(CategoryEO categoryEO) {
		return null;
	}

	public CategoryEO fetch(Integer categoryId) {
		return null;
	}

	public List<CategoryEO> fetchAll() {
		return null;
	}

	public void delete(Integer categoryId) {
	}

}
